package com.xuecheng.content.api;

import com.xuecheng.content.model.dto.SaveTeachPlanDto;
import com.xuecheng.content.model.dto.TeachplanDto;
import com.xuecheng.content.service.TeachplanService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Date:2023/7/10
 * Author:丐版小杨哥
 * Description:
 */
@Slf4j
@ApiOperation("教学计划接口")
@RestController
public class TeachplanController {
    @Autowired
    private TeachplanService teachplanService;
    @ApiOperation("查询授课计划树形结构")
    @GetMapping("/teachplan/{courseId}/tree-nodes")
    public List<TeachplanDto> getTreeNodes(@PathVariable Long courseId){
        return teachplanService.getTreeNodes(courseId);
    }
    @ApiOperation("新增章节大小，修改章节")
    @PostMapping("/teachplan")
    public void saveTeachPlan(@RequestBody SaveTeachPlanDto planDto){
        teachplanService.saveTeachPlan(planDto);
    }
}
